package cn.xhy.material.dal.mysql.model;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.xhy.material.controller.admin.model.vo.ModelPageReqVO;
import cn.xhy.material.dal.dataobject.model.ModelDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 规格 Mapper
 *
 * @author xhy
 */
@Mapper
public interface ModelMapper extends BaseMapperX<ModelDO> {

    default PageResult<ModelDO> selectPage(ModelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ModelDO>()
                .eqIfPresent(ModelDO::getModel, reqVO.getModel())
                .eqIfPresent(ModelDO::getType, reqVO.getType())
                .betweenIfPresent(ModelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ModelDO::getId));
    }

}
